const { DataTypes } = require('sequelize')

const sequelize = require('../db/sequelize')

const Goods = sequelize.define("nk_goods", {
    // id 自动创建
    goods_name: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: '商品名称'
    },
    goods_price: {
        type: DataTypes.DECIMAL(10, 2),
        allowNull: false,
        comment: '商品价格'
    },
    goods_num: {
        type: DataTypes.INTEGER,
        allowNull: false,
        defaultValue: 0,
        comment: '商品库存'
    },
    goods_img: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: '商品图片URL'
    }
}, {
    timestamps: true ,//时间戳字段
    paranoid: true,
}, )

// 强制创建表
// Goods.sync({ focus: true })

module.exports = Goods